import QtQuick 2.0
import QtQuick.Controls 1.4
import QtQuick.Controls.Styles 1.4

import "../../js/util.js" as Util
import com.loogear.softphone 1.0

ACellRow {

    property alias m_checkBox: m_checkBox_id
    property alias m_headSource: m_head.m_source
    property alias m_name: m_NameText_id.text
//    property alias m_phone: m_PhoneText_id.text
    signal clickSignal()

    m_leftItem: Item {
        width: m_lineValue
        height: m_lineValue

        HeadImage {
            id: m_head
            width: parent.width*0.7
            height: parent.height*0.7
            anchors.centerIn: parent
//            m_source: model.picname
        }
    }

    m_centerItem: Column {
        width: m_root_id.width - m_lineValue*2

        AText {
            id: m_NameText_id
            width: parent.width
            font.pointSize: 18
            elide: Text.ElideRight
            wrapMode: Text.NoWrap
//            text: model.nickName === ""
//                  ? (model.name === "" ? model.phone1 : model.name)
//                  : model.nickName
        }

//        AText {
//            id: m_PhoneText_id
//            width: m_root_id.width - m_lineValue*2
//            font.pointSize: 16
//            elide: Text.ElideRight
//            wrapMode: Text.NoWrap
//            text: model.phone1
//            color: "#808080"
//        }
    }

    m_rightItem: Item {
        width: m_lineValue
        height: m_lineValue

        CheckBox {
            id: m_checkBox_id
            width: parent.height*0.3
            height: parent.height*0.3
            anchors.centerIn: parent
            style: CheckBoxStyle {
                background: Image {
                    source: control.checked ? "qrc:/images/icon_xuanzhong.png"
                                            : "qrc:/images/icon_weixuanzhong.png"
                }

                indicator: Item{}
            }
            onCheckedChanged: {
                clickSignal()
            }
        }
    }

    MouseArea{
        id: mouse
        anchors.fill: parent
        onClicked: {
            m_checkBox.checked = !m_checkBox.checked
        }
    }

    color: mouse.pressed ? "#aaaaaa":"#ffffff"
}

